package com.globalwave.eps.web;

import com.globalwave.base.BaseAction;
import com.globalwave.common.ArrayPageList;
import com.globalwave.eps.entity.ElectricityProjectLine;
import com.globalwave.eps.entity.ElectricityProjectLineCriterion;
import com.globalwave.eps.service.ElectricityProjectLineService;
import com.opensymphony.xwork2.Preparable;

public class ElectricityProjectLineAction extends BaseAction implements Preparable {

    private static final long serialVersionUID = 8582051849254108462L;
    
    private ElectricityProjectLineService electricityProjectLineService ;
    private ElectricityProjectLine electricityProjectLine ;
    private ElectricityProjectLineCriterion criterion ; 

    
    public String execute() throws Exception {    
        return this.list();    
    }
    
    public String list() throws Exception {      
        
        ArrayPageList<ElectricityProjectLine> pageList = 
            electricityProjectLineService.query(criterion,pageIndex,pageSize,null) ;

        renderXML(pageList.asXML()) ;
        
        return null ;    
        
    }
    
    public String create()  throws Exception {              
        
        Object newElectricityProjectLine = electricityProjectLineService.create(electricityProjectLine) ;

        renderXML(this.getSuccessCreateMessage(newElectricityProjectLine).asXML()) ;
        
        return null;    
        
    }
    
    public String update()  throws Exception {     
        
        electricityProjectLineService.update(electricityProjectLine) ;

        renderXML(this.getSuccessUpdateMessage(electricityProjectLine).asXML()) ;
        
        return null;    
        
    }
    
    public String delete()  throws Exception {
        if (ids == null) { 
            electricityProjectLineService.delete(electricityProjectLine) ;
        } else {
            electricityProjectLineService.deleteAll(ids) ;
        }

        renderXML(this.getSuccessDeleteMessage().asXML()) ;
        
        return null;    
        
    }
    
    public void prepare() throws Exception {
        // Auto-generated method stub , donothing
        
    }
    
    public void setElectricityProjectLineService(ElectricityProjectLineService electricityProjectLineService) {
        this.electricityProjectLineService = electricityProjectLineService;
    }

    public ElectricityProjectLine getElectricityProjectLine() {
        return electricityProjectLine;
    }

    public void setElectricityProjectLine(ElectricityProjectLine electricityProjectLine) {
        this.electricityProjectLine = electricityProjectLine;
    }

    public ElectricityProjectLineCriterion getCriterion() {
        return criterion;
    }

    public void setCriterion(ElectricityProjectLineCriterion criterion) {
        this.criterion = criterion;
    }

}
